< previous page page_428 next page >

Page 428
note.gif Although a Shape control placed behind a set of controls can appear to visually enclose other controls, it cannot act as a container for those controls. square.gif

sarrow.gifSee "Using Containers," p. 66
Although you can set the Shape control to several different types of shapes, it does not use mathematical coordinates as the Line control does. Instead, you use the Height and Width properties to set the size of a shape.
Pictures and Images
Another way to enhance your user interface with graphics is to place actual pictures on your form. These pictures can be loaded into the Image and PictureBox controls or on the form itself. Some possible sources for pictures are drawings you have created in a paint program or 35mm photos converted to files by your scanner. The types of files you can display are listed in Table 19.1.
Table 19.1 Graphics File Formats Compatible with Visual Basic
File ExtensionType of File
.BMPWindows bitmap file
.DIBDevice Independent Bitmap file
.ICO, .CURIcon
.WMFWindows metafile
.EMFEnhanced Windows metafile
.GIFGraphics Interchange Format; a file format originally developed by CompuServe and used on Internet Web pages
.JPGJPEG images, named after the Joint Photographic Experts Group; similar to GIF but uses compression to reduce file size; used extensively on Internet Web pages

Using the Picture Property
The PictureBox control, Image control, and form all have a Picture property that can be set either at designtime or runtime. Loading an image file at designtime is easy. Try a simple example by placing an image on a form, as shown here:
1. Start a new project, and bring up the Properties window for the form.
2. Click the ellipsis button at the far right of the line to call up the Load Picture dialog box, shown in Figure 19.3.
3. From the Load Picture dialog box, select a picture file. The selected picture then appears on your form.
note.gif Files loaded at designtime are stored saved with your form, which can increase program size and form load time. square.gif

 
< previous page page_428 next page >